import { ReactNode } from 'react'
import { Form, Space, Button, FormInstance } from 'antd'
import styles from './index.module.less'

interface IProps {
  children: ReactNode
  form: FormInstance
  initialValues?: Record<string, any>
  submit: () => void
  reset: () => void
}
export default function SearchForm(props: IProps) {
  return (
    <Form
      className={styles['search-form']}
      form={props.form}
      layout='inline'
      initialValues={props?.initialValues || {}}
    >
      {props.children}
      <Form.Item>
        <Space>
          <Button type='primary' onClick={props.submit}>
            搜索
          </Button>
          <Button type='default' onClick={props.reset}>
            重置
          </Button>
        </Space>
      </Form.Item>
    </Form>
  )
}
